package cn.jn.lhm.statistics.handler;

import cn.jn.lhm.statistics.entity.vo.EchartsVo;
import cn.jn.lhm.statistics.service.StatisticsService;
import cn.jn.lhm.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author LHM
 * @Tips 热爱每一天，奋斗每一天
 * @date 2020/6/18 - 18:42
 */
@RestController
@Slf4j
@RequestMapping("/statistics")
public class StatisticsHandler {

    @Resource
    private StatisticsService statisticsService;

    @PostMapping("/count/register/{day}")
    public R countRegister(@PathVariable("day")String day){
        statisticsService.countRegisterNumber(day);
        return R.ok();
    }

    @PostMapping("/showData")
    public R showData(@RequestBody EchartsVo echartsVo){
        Map<String, Object> map = statisticsService.showData(echartsVo);
        return R.ok().data(map);
    }
}
